<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" layout:decorate="main"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
    <title>用户修改</title>
    <link th:href="@{/localcss/crmlist.css}" href="../static/localcss/crmadd.css" rel="stylesheet">
</head>
<body>
<div layout:fragment="content">
    <div class="">
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>修改用户信息 <i class="fa fa-user"></i></h2>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="clearfix"></div>
                        <form class="form-horizontal form-label-left" th:action="@{/user/save}" action="/user/save"
                              method="post">
                            <input type="hidden" name="usrId" id="usrId" value="1" th:value="${user.usrId}">
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="usrName"> 用户名 <span
                                        class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="usrName" class="form-control col-md-7 col-xs-12"
                                           th:value="${user.usrName}"
                                           data-validate-length-range="10" data-validate-words="1" name="usrName"
                                           required="required"
                                           placeholder="请输入用户名" type="text">
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="usrPassword"> 密码 <span
                                        class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="usrPassword" class="form-control col-md-7 col-xs-12"
                                           th:value="${user.usrPassword}"
                                           data-validate-length-range="10" data-validate-words="1" name="usrPassword"
                                           required="required"
                                           placeholder="请输入密码" type="password">
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="roleId"> 用户角色 <span
                                        class="required">*</span></label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="usrRoleId" id="roleId" class="form-control" required="required">
                                        <option th:selected="${role.roleId eq user.usrRoleId}" th:each="role:${roles}"
                                                th:value="${role.roleId}" th:text="${role.roleName}" value="">角色
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="usrFlag"> 角色状态
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="usrFlag" name="usrFlag" type="checkbox" th:checked="${user.usrFlag==1}"
                                           th:value="${user.usrFlag}" value="1">
                                    (是否启用)
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-3">
                                    <button id="send" type="submit" class="btn btn-success">保存</button>
                                    <button type="button" class="btn btn-primary" id="back">返回</button>
                                    <br/><br/>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script layout:fragment="js">
    $(document).ready(function () {
        $("#back").on("click", function () {
            window.history.back();
        });
    });
</script>
</html>